import tool from '@/commons/libraries/tool'

export const jwt = (state) =>{
  return state.jwt
}
export const name = (state) =>{
  return state.name
}
export const getTypeOptions = (state, getters) => (index, value) =>{
  if(tool.isEmpty(value)){
    return
  }
  let item = state.commonsState[index].find(item => item.value === value)
  if(item !== ''){
    return item.text
  }
  return '没有找到'
}
export const getChartOptions = (state, getters) => (index, value) =>{
  if(tool.isEmpty(index)){
    return
  }
  let item = state.commonsState[index].find(item => item.value === value)
  if(item !== ''){
    delete item.value
    return item
  }
  return '没有找到'
}
export const getChartName = (state, getters) => (index, value) =>{
  if(tool.isEmpty(index)){
    return
  }
  let item = state.commonsState[index].find(item => item.value === value)
  if(item !== ''){
    return item.name
  }
  return '没有找到'
}
